/**
 * 
 */
package org.sword.wechat4j.token.server;

import org.sword.wechat4j.common.WechatConfig;
import org.sword.wechat4j.token.Ticket;
import org.sword.wechat4j.token.TicketType;

/**
 * Ticket server适配器
 * 
 * @author ChengNing
 * @date 2015年1月29日
 */
public class JsApiTicketServer extends AbsServer implements TicketServer {

	private final String accessToken;

	public JsApiTicketServer(String accessToken, WechatConfig wechatConfig) {
		super(wechatConfig);
		this.accessToken = accessToken;
	}

	/**
	 * 
	 */
	public String ticket() {
		return super.token();
	}

	/**
	 * 
	 */
	@Override
	protected String getCustomerServerClass() {
		return wechatConfig.getJsApiTicketServer();
	}

	/**
	 * 
	 */
	@Override
	public IServer defaultServer() {
		return new JsApiTicketMemServer(new Ticket(accessToken, TicketType.jsapi));
	}

}
